//this file define ParallelTester interface
//andycai_sc 2011-05-15

#ifndef GPARALLELTESTER_H
#define GPARALLELTESTER_H

#include <string>
#include <vector>
#include <iostream>
#include "GTpl/GMap.h"

using std::string;
using std::vector;
using std::cout;
using std::endl;

class GParallelTester
{
public:
	virtual ~GParallelTester() {}

	const string& getTestName() { return m_testName; }

	virtual void run() = 0;

protected:
	GParallelTester(const string& testName) : m_testName(testName)
	{
	}
	string m_testName;
};

class GParallelTestRunner
{
public:
	GParallelTestRunner(int argc, char** argv);
	~GParallelTestRunner();

	bool parseArgs();

	void addTester(GParallelTester*);

	void runTest();

private:
	void help();
	void run(GParallelTester* tester);

	GMap<string, GParallelTester*> *m_testers;
	vector<string> m_args;
	vector<GParallelTester*> m_runalbeTesters;
	bool m_isAll;
	vector<string> m_unknownTests;
};

#endif
